Skip to content

fix: Print stderr for list-all / latest-stable callbacks#2154

Closed
CGA1123 wants to merge 3 commits into
asdf-vm:masterfrom
CGA1123:cga1123/stderr-list-all
Closed

fix: Print stderr for list-all / latest-stable callbacks#2154
CGA1123 wants to merge 3 commits into
asdf-vm:masterfrom
CGA1123:cga1123/stderr-list-all

Conversation

@CGA1123

@CGA1123 CGA1123 commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

Summary

This updates usages of list-all and latest-stable plugin callbacks to dump their stderr to asdf's stderr, so that plugins can provide more context around why plugin installation may have failed during version resolution.

This updates usages of `list-all` and `latest-stable` plugin callbacks
to dump their stderr to `asdf`'s stderr, so that plugins can provide
more context around why plugin installation may fail.
@CGA1123
CGA1123 requested a review from a team as a code owner July 22, 2025 12:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the version-resolution path to forward plugin callback stderr (latest-stable and list-all) to asdf’s stderr, making failures during “latest” resolution easier to diagnose.

Changes:

  • Updated versions.Latest / versions.AllVersions APIs to accept an io.Writer for stderr and wire it through to Plugin.RunCallback.
  • Updated CLI call sites to pass stderr through when resolving “latest”.
  • Extended tests to validate that list-all callback stderr is captured when the callback fails.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/versions/versions.go Threads a provided stderr writer into latest-stable/list-all callback execution.
internal/versions/versions_test.go Updates call sites for new signatures and adds coverage for propagating callback stderr on failure.
internal/cli/set/set.go Updates set command’s “latest” resolution to call the new versions.Latest signature.
internal/cli/cli.go Updates latest command flow to pass stderr into versions.Latest via latestForPlugin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cli/set/set.go
Comment on lines 41 to 44
if parsedVersion.Type == "latest" {
plugin := plugins.New(conf, args[0])
resolvedVersion, err := versions.Latest(plugin, parsedVersion.Value)
resolvedVersion, err := versions.Latest(plugin, parsedVersion.Value, os.Stderr)
if err != nil {
Comment thread internal/cli/cli.go
Comment on lines +1582 to 1586
func latestForPlugin(conf config.Config, toolName, pattern string, showStatus bool, errOut io.Writer) error {
// show single plugin
plugin := plugins.New(conf, toolName)
latest, err := versions.Latest(plugin, pattern)
latest, err := versions.Latest(plugin, pattern, errOut)
if err != nil && err.Error() != "no latest version found" {
@Stratus3D

Copy link
Copy Markdown
Member

Thanks for the PR @CGA1123 ! I made a small update to these changes and then merged them. They will go out in the next release.

@Stratus3D Stratus3D closed this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants